package interclass;

public class Test2 {
    //搞清楚匿名类的使用方法
    public static void main(String[] args) {
        Swim s1 = new Swim()
        {
            @Override
            public void swim()
            {
                System.out.println("老师游泳贼溜");
            }
        };
        start(s1);
        System.out.println("===================");
        Swim s2 = new Swim()
        {
            @Override
          public void swim()
          {
                System.out.println("学生游泳贼好");
          }
        };
    }

    public static void start(Swim s) {
        System.out.println("开始---------");

        System.out.println("结束---------");
    }

}
//        class Teacher implements Swim
//        {
//            public void swim()
//            {
//                System.out.println("老师游泳贼溜");
//            }
//        }
//
//        class Student implements Swim
//        {
//            public void swim()
//            {
//                System.out.println("学生游泳贼好");
//            }
//        }

        interface Swim
        {
            void swim();
        }




